package com.ruoyi.xh.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.xh.domain.XhAddress;
import com.ruoyi.xh.mapper.XhAddressMapper;
import com.ruoyi.xh.service.IXhAddressService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 收获地址Service业务层处理
 *
 * @author songjw
 * @date 2024-12-13
 */
@Service
public class XhAddressServiceImpl extends ServiceImpl<XhAddressMapper, XhAddress> implements IXhAddressService {

    /**
     * 查询收获地址
     *
     * @param id 收获地址主键
     * @return 收获地址
     */
    @Override
    public XhAddress selectXhAddressById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询收获地址列表
     *
     * @param xhAddress 收获地址
     * @return 收获地址
     */
    @Override
    public Page<XhAddress> selectXhAddressList(XhAddress xhAddress) {
        return new Page<>();
    }

    /**
     * 新增收获地址
     *
     * @param xhAddress 收获地址
     */
    @Override
    public void insertXhAddress(XhAddress xhAddress) {
        this.save(xhAddress);
    }

    /**
     * 修改收获地址
     *
     * @param xhAddress 收获地址
     */
    @Override
    public void updateXhAddress(XhAddress xhAddress) {
        this.updateById(xhAddress);
    }

    /**
     * 批量删除收获地址
     *
     * @param ids 需要删除的收获地址主键
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteXhAddressByIds(Long[] ids) {
        this.removeByIds(Stream.of(ids).collect(Collectors.toSet()));
    }
}
